package OO;
import utils.*;

public class Inheritance3 {
	public static void main(String args[]) {
		A a = new A();
		B b = new B();
		
		Utils.println(a.getNum());
		Utils.println(b.getNum());
		
		A a1 = (A)new B();
		Utils.println(a1.getNum());
		A a2 = a1;
		Utils.println(a2.getNum());
		B b1 = (B)a1;
		Utils.println(b1.getNum());
	}
}

class A{
	int getNum(){
		return 1;
	}
}

class B extends A{
	int getNum(){
		return 2;
	}
}
